/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "col_cronograma")
//@NamedQueries({@NamedQuery(name = "Cronograma.findAll", query = "SELECT c FROM Cronograma c"), @NamedQuery(name = "Cronograma.findByCroCodigo", query = "SELECT c FROM Cronograma c WHERE c.croCodigo = :croCodigo"), @NamedQuery(name = "Cronograma.findByCroAnio", query = "SELECT c FROM Cronograma c WHERE c.croAnio = :croAnio"), @NamedQuery(name = "Cronograma.findByCrofechaRegistro", query = "SELECT c FROM Cronograma c WHERE c.crofechaRegistro = :crofechaRegistro")})
public class Cronograma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cro_codigo")
    private Integer croCodigo;
    @Basic(optional = false)
    @Column(name = "cro_anio")
    private String croAnio;
    @Basic(optional = false)
    @Column(name = "cro_fechaRegistro")
    @Temporal(TemporalType.DATE)
    private Date crofechaRegistro;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cronograma", fetch = FetchType.LAZY)
    private List<Detallecronograma> detallecronogramaCollection;

    public Cronograma() {
    }

    public Cronograma(Integer croCodigo) {
        this.croCodigo = croCodigo;
    }

    public Cronograma(Integer croCodigo, String croAnio, Date crofechaRegistro) {
        this.croCodigo = croCodigo;
        this.croAnio = croAnio;
        this.crofechaRegistro = crofechaRegistro;
    }

    public Integer getCroCodigo() {
        return croCodigo;
    }

    public void setCroCodigo(Integer croCodigo) {
        this.croCodigo = croCodigo;
    }

    public String getCroAnio() {
        return croAnio;
    }

    public void setCroAnio(String croAnio) {
        this.croAnio = croAnio;
    }

    public Date getCrofechaRegistro() {
        return crofechaRegistro;
    }

//    public String getFechaRegistro(){
//        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
//        return sdf.format(crofechaRegistro);
//    }

    public void setCrofechaRegistro(Date crofechaRegistro) {
        this.crofechaRegistro = crofechaRegistro;
    }

    public List<Detallecronograma> getDetallecronogramaCollection() {
        return detallecronogramaCollection;
    }

    public void setDetallecronogramaCollection(List<Detallecronograma> detallecronogramaCollection) {
        this.detallecronogramaCollection = detallecronogramaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (croCodigo != null ? croCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cronograma)) {
            return false;
        }
        Cronograma other = (Cronograma) object;
        if ((this.croCodigo == null && other.croCodigo != null) || (this.croCodigo != null && !this.croCodigo.equals(other.croCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.Cronograma[croCodigo=" + croCodigo + "]";
    }

}
